﻿using System.Collections.Generic;
using System.Linq;
using UnityEngine;

[CreateAssetMenu(fileName = "Effect38-每回合根据友军士兵数量设置自己的攻击力", menuName = "Skill/Effect/Effect38-根据友军士兵数量设置自己的攻击力", order = 38)]
public class Effect38 : EffectBase
{
    public override void Apply(Pair pair, GameEvent e, List<Chess> targets)
    {
        if(targets == null || targets.Count == 0) return;
        foreach (var chess in targets)
        {
            var count = 0;
            foreach (var c in ChessManager.GetInstance().chessList)
            {
                if (c.GetChessSide() == chess.GetChessSide())
                    count++;
            }
            chess.ChessDetail.Attack = count;
        }
    }
}